﻿using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;

namespace EvoBoost.Core
{
	public class TrainingTestStatistics<T>
	{
		private readonly List<double> trainingErrors;

		private readonly List<double> testErrors;

        internal TrainingTestStatistics(Forest<T> model, IEnumerable<double> trainingErrors, IEnumerable<double> testErrors)
		{
			Debug.Assert(trainingErrors != null && testErrors != null);
			Debug.Assert(trainingErrors.Count() == testErrors.Count());
			Debug.Assert(model != null);
			
			this.trainingErrors = new List<double>(trainingErrors);
			this.testErrors = new List<double>(testErrors);
        	this.Model = model;
		}

		public ReadOnlyCollection<double> TestErrors
		{
			get { return this.testErrors.AsReadOnly(); }
		}

		public ReadOnlyCollection<double> TrainingErrors
		{
			get { return this.trainingErrors.AsReadOnly(); }
		}

		public Forest<T> Model { get; private set; }
	}
}
